﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Linq;
using System.Collections.Generic;

namespace Storage
{
    public class DBHelper
    {
        private const string conn = @"Data Source = 'appdata:/Northwind.sdf'; File Mode = read only;";
        public static void CreateDatabase()
        {
            using (var context = new NorthwindDataContext(conn))
            {
                if (!context.DatabaseExists())
                {
                    context.CreateDatabase();
                }
            }
        }
        public static void DeleteDatabase()
        {
            using (var context = new NorthwindDataContext(conn))
            {
                if (context.DatabaseExists())
                {
                    context.DeleteDatabase();
                }
            }
        }
        public static IList<Employee> GetEmployees()
        {
            IList<Employee> employees;
            using (var context = new NorthwindDataContext(conn))
            {
                employees = (from emp in context.Employees select emp).ToList();
            }
            return employees;
        }
    }
}
